package cn.edu.sjtu.se.dslab.component.aadl;

import java.io.Serializable;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import cn.edu.sjtu.se.dslab.project.PGroup;

/**
 * aadl模板类
 * @author sunke
 *
 */
@Entity
@Table(name = "aadl_template")
public class AADLTemplate  implements Serializable{
	
	/**
	 * 
	 */
	private static final long serialVersionUID = -6332060629501058020L;

	private long id;
	
	private String name;
	
	private String description;
	
	private AADLModel model;
	
	private String uri;
	
	private boolean deleted;
	
	private PGroup group;
	
	@Column(name = "deleted", nullable = true)
	public boolean isDeleted() {
		return deleted;
	}
	public void setDeleted(boolean deleted) {
		this.deleted = deleted;
	}
	
	@Id
	@GeneratedValue(strategy = GenerationType.AUTO)
	public long getId() {
		return id;
	}

	public void setId(long id) {
		this.id = id;
	}
	@Column(name = "name", nullable = false, length = 255)
	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}
	@Column(name = "description", nullable = true, length = 255)
	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}
	@ManyToOne(cascade = { CascadeType.REFRESH })
	@JoinColumn(name = "model_id")
	public AADLModel getModel() {
		return model;
	}

	public void setModel(AADLModel model) {
		this.model = model;
	}
	@Column(name = "uri", nullable = false, length = 255)
	public String getUri() {
		return uri;
	}

	public void setUri(String uri) {
		this.uri = uri;
	}
	
	@ManyToOne(cascade = { CascadeType.REFRESH })
	@JoinColumn(name = "group_id",nullable = true)
	public PGroup getGroup() {
		return group;
	}
	public void setGroup(PGroup group) {
		this.group = group;
	}
	
	
}
